import datetime
from tortoise.models import Model
from tortoise import fields


class DictType(Model):
    id = fields.IntField(pk=True)
    type_name = fields.CharField(max_length=255, description="字典类型名称")
    type_code = fields.CharField(max_length=255, description="字典类型标识")
    description = fields.CharField(max_length=255, description="字典类型描述")
    enable = fields.IntField(description="是否开启", default=1)
    create_time = fields.DatetimeField(auto_now_add=True, description="创建时间")
    update_time = fields.DatetimeField(auto_now=True, description="更新时间")

    class Meta:
        table = "admin_dict_type"


class DictData(Model):
    id = fields.BigIntField(pk=True)
    data_label = fields.CharField(max_length=255, description="字典类型名称")
    data_value = fields.CharField(max_length=255, description="字典类型标识")
    type_code = fields.CharField(max_length=255, description="字典类型描述")
    is_default = fields.IntField(description="是否默认", default=0)
    enable = fields.IntField(description="是否开启", default=1)
    remark = fields.CharField(max_length=255, description="备注", null=True)
    create_time = fields.DatetimeField(auto_now_add=True, description="创建时间")
    update_time = fields.DatetimeField(auto_now=True, description="更新时间")

    class Meta:
        table = "admin_dict_data"
